package com.tz.farmer.controller;

import com.smartPark.msframe.result.ResultEx;
import com.tz.farmer.service.DataOfShareService;
import com.tz.farmer.so.DataOfShareSo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/dataofshare")
public class DataOfShareController {

    @Resource
    DataOfShareService  dataOfShareService;

    @GetMapping("/three")
    @ApiOperation("查询")
    public ResultEx getDataOfShare(){
        Map dataOfShare = dataOfShareService.getDataOfShare();
        return ResultEx.builder().makeSuccessResult(dataOfShare);
    }

    @PostMapping("/edit")
    @ApiOperation("修改")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "自增id", dataType = "int", defaultValue = "", required = true),
            @ApiImplicitParam(name = "aNum", value = "a_num可代表：流通商品、渔船信息数、种养经营户数量", dataType = "int", defaultValue = "", required = false),
            @ApiImplicitParam(name = "bNum", value = "b_num课代表：流通信息企业数、作业渔区数、种养产品信息数", dataType = "string", defaultValue = "", required = false),
            @ApiImplicitParam(name = "cNum", value = "c_num可代表：产品批次数、渔获种类数、产品销售批次数", dataType = "string", defaultValue = "", required = false),
            @ApiImplicitParam(name = "dNum", value = "d_num课代表：捕捞数、生产作业记录数", dataType = "int", defaultValue = "", required = false)
    })
    public ResultEx updateDataOfShare(@RequestBody  DataOfShareSo so ){
        return dataOfShareService.updateDataOfShare(so);

    }

}
